package home.ui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class MainFrame {

	JFrame frame = new JFrame("Parser_0.02");
	JLabel labelMain = new JLabel("Mego PARSER V_0.02");
	JLabel labelChoseFileText = new JLabel("Select file:");
	JTextField textFieldChoseFile = new JTextField(); 
	
	JButton button = new JButton("Choose file");
	JButton buttonNew = new JButton("Button2");
	JFileChooser fileChooser = new JFileChooser();
	JPanel panel = new JPanel();
	
	int i = 0;

	
	private void initFrame(){
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setPreferredSize(new Dimension(600, 700));
		frame.setSize(500, 250);
		frame.setLocation(400, 200);
		frame.setVisible(true);
		
//		frame.getContentPane().setLayout(new GridLayout(3,1,2,2));
//		frame.getContentPane().setLayout(new GridLayout(6,3));
//		frame
//		frame.getContentPane().setLayout(new GridLayout(0, 3));
//		frame.getContentPane().setLayout(new GridLayout());
//		frame.getContentPane().setLayout(new GridBagLayout());
		
//		frame.getContentPane().add(labelMain);
//		frame.getContentPane().add(labelChoseFileText);
//		frame.getContentPane().add(button);
//		frame.getContentPane().add(buttonNew);
//		frame.getContentPane().add(fileChooser);
		
		
//		panel.setLayout(new BorderLayout());
		
//		frame.setLayout(null);
		panel.setLayout(null);
//		labelMain.setSize(20, 30);
//		labelMain.setLocation(100, 260);
		
		labelMain.setBounds(10, 0,150, 15);
		panel.add(labelMain);
		frame.getContentPane().add(panel);
//		button.setLocation(200, 140);
//		button.setSize(10, 20);
//		panel.add(button);
//		frame.getContentPane().add(panel);
//		
//		panel.add(labelMain, BorderLayout.NORTH);
//		panel.add(comp)
		
//		JPanel centerPanel = new JPanel(new BorderLayout());

		textFieldChoseFile.setSize(10, 100);
		
//		centerPanel.add(labelChoseFileText,BorderLayout.WEST);
//		centerPanel.add(textFieldChoseFile,BorderLayout.CENTER);
//		centerPanel.add(button,BorderLayout.EAST);
//		
//		panel.add(centerPanel, BorderLayout.CENTER);
		
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				labelMain.setText("New="+i++);
			}
		});
		
		
		
		
	}
	
	
	public MainFrame() {
		initFrame();
	}

}
